package com.example.yoga.util;

/**
 *响应数据的格式类
 * @param <T>  携带数据类型
 */
public class JsonResult<T> {

    private Integer state;//状态码  404

    private String message;//消息描述  NotFound

    private T data;



    public JsonResult() {
    }

    //相应格式的消息,Throwable异常体系中的最高级
    public JsonResult(Throwable e) {
        this.message=e.getMessage();
    }

    public JsonResult(Integer state) {
        this.state = state;
    }

    public JsonResult(Integer state, String message) {
        this.state = state;
        this.message = message;
    }

    public JsonResult(Integer state, T data) {
        this.state = state;
        this.data = data;
    }

    public JsonResult(T data) {
        this.data = data;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

}
